.class public Lorg/zeam/ColourPickerDialog;
.super Landroid/app/Dialog;
.source "ColourPickerDialog.java"

# interfaces
.implements Lorg/zeam/ColourPickerView$OnColourChangedListener;
.implements Landroid/view/View$OnClickListener;


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lorg/zeam/ColourPickerDialog$OnColourChangedListener;
    }
.end annotation


# instance fields
.field private mColourPicker:Lorg/zeam/ColourPickerView;

.field private mNewColour:Lorg/zeam/ColourPickerPanelView;

.field private mOldColour:Lorg/zeam/ColourPickerPanelView;

.field private mOnColourChangedListener:Lorg/zeam/ColourPickerDialog$OnColourChangedListener;


# direct methods
.method public constructor <init>(Landroid/content/Context;I)V
    .locals 0
    .parameter "context"
    .parameter "initialColor"

    .prologue
    .line 24
    invoke-direct {p0, p1}, Landroid/app/Dialog;-><init>(Landroid/content/Context;)V

    .line 26
    invoke-direct {p0, p2}, Lorg/zeam/ColourPickerDialog;->init(I)V

    .line 27
    return-void
.end method

.method private init(I)V
    .locals 2
    .parameter "color"

    .prologue
    .line 31
    invoke-virtual {p0}, Lorg/zeam/ColourPickerDialog;->getWindow()Landroid/view/Window;

    move-result-object v0

    const/4 v1, 0x1

    invoke-virtual {v0, v1}, Landroid/view/Window;->setFormat(I)V

    .line 32
    invoke-direct {p0, p1}, Lorg/zeam/ColourPickerDialog;->setup(I)V

    .line 33
    return-void
.end method

.method private setup(I)V
    .locals 7
    .parameter "color"

    .prologue
    const/4 v6, 0x0

    .line 37
    invoke-virtual {p0}, Lorg/zeam/ColourPickerDialog;->getContext()Landroid/content/Context;

    move-result-object v0

    .line 38
    .local v0, context:Landroid/content/Context;
    const-string v3, "layout_inflater"

    invoke-virtual {v0, v3}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Landroid/view/LayoutInflater;

    .line 39
    .local v1, inflater:Landroid/view/LayoutInflater;
    const v3, 0x7f030008

    const/4 v4, 0x0

    invoke-virtual {v1, v3, v4}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;)Landroid/view/View;

    move-result-object v2

    .line 41
    .local v2, layout:Landroid/view/View;
    invoke-virtual {p0, v2}, Lorg/zeam/ColourPickerDialog;->setContentView(Landroid/view/View;)V

    .line 42
    const v3, 0x7f0a0065

    invoke-virtual {p0, v3}, Lorg/zeam/ColourPickerDialog;->setTitle(I)V

    .line 44
    const v3, 0x7f060009

    invoke-virtual {v2, v3}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v3

    check-cast v3, Lorg/zeam/ColourPickerView;

    iput-object v3, p0, Lorg/zeam/ColourPickerDialog;->mColourPicker:Lorg/zeam/ColourPickerView;

    .line 45
    const v3, 0x7f06000a

    invoke-virtual {v2, v3}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v3

    check-cast v3, Lorg/zeam/ColourPickerPanelView;

    iput-object v3, p0, Lorg/zeam/ColourPickerDialog;->mOldColour:Lorg/zeam/ColourPickerPanelView;

    .line 46
    const v3, 0x7f06000b

    invoke-virtual {v2, v3}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v3

    check-cast v3, Lorg/zeam/ColourPickerPanelView;

    iput-object v3, p0, Lorg/zeam/ColourPickerDialog;->mNewColour:Lorg/zeam/ColourPickerPanelView;

    .line 48
    iget-object v3, p0, Lorg/zeam/ColourPickerDialog;->mOldColour:Lorg/zeam/ColourPickerPanelView;

    invoke-virtual {v3}, Lorg/zeam/ColourPickerPanelView;->getParent()Landroid/view/ViewParent;

    move-result-object v3

    check-cast v3, Landroid/widget/LinearLayout;

    .line 49
    iget-object v4, p0, Lorg/zeam/ColourPickerDialog;->mColourPicker:Lorg/zeam/ColourPickerView;

    invoke-virtual {v4}, Lorg/zeam/ColourPickerView;->getDrawingOffset()F

    move-result v4

    invoke-static {v4}, Ljava/lang/Math;->round(F)I

    move-result v4

    .line 50
    iget-object v5, p0, Lorg/zeam/ColourPickerDialog;->mColourPicker:Lorg/zeam/ColourPickerView;

    invoke-virtual {v5}, Lorg/zeam/ColourPickerView;->getDrawingOffset()F

    move-result v5

    invoke-static {v5}, Ljava/lang/Math;->round(F)I

    move-result v5

    .line 49
    invoke-virtual {v3, v4, v6, v5, v6}, Landroid/widget/LinearLayout;->setPadding(IIII)V

    .line 52
    iget-object v3, p0, Lorg/zeam/ColourPickerDialog;->mOldColour:Lorg/zeam/ColourPickerPanelView;

    invoke-virtual {v3, p0}, Lorg/zeam/ColourPickerPanelView;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 53
    iget-object v3, p0, Lorg/zeam/ColourPickerDialog;->mNewColour:Lorg/zeam/ColourPickerPanelView;

    invoke-virtual {v3, p0}, Lorg/zeam/ColourPickerPanelView;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 54
    iget-object v3, p0, Lorg/zeam/ColourPickerDialog;->mColourPicker:Lorg/zeam/ColourPickerView;

    invoke-virtual {v3, p0}, Lorg/zeam/ColourPickerView;->setOnColorChangedListener(Lorg/zeam/ColourPickerView$OnColourChangedListener;)V

    .line 55
    iget-object v3, p0, Lorg/zeam/ColourPickerDialog;->mOldColour:Lorg/zeam/ColourPickerPanelView;

    invoke-virtual {v3, p1}, Lorg/zeam/ColourPickerPanelView;->setColor(I)V

    .line 56
    iget-object v3, p0, Lorg/zeam/ColourPickerDialog;->mColourPicker:Lorg/zeam/ColourPickerView;

    const/4 v4, 0x1

    invoke-virtual {v3, p1, v4}, Lorg/zeam/ColourPickerView;->setColor(IZ)V

    .line 57
    return-void
.end method


# virtual methods
.method public getColor()I
    .locals 1

    .prologue
    .line 73
    iget-object v0, p0, Lorg/zeam/ColourPickerDialog;->mColourPicker:Lorg/zeam/ColourPickerView;

    invoke-virtual {v0}, Lorg/zeam/ColourPickerView;->getColour()I

    move-result v0

    return v0
.end method

.method public onClick(Landroid/view/View;)V
    .locals 2
    .parameter "view"

    .prologue
    .line 79
    invoke-virtual {p1}, Landroid/view/View;->getId()I

    move-result v0

    packed-switch v0, :pswitch_data_0

    .line 88
    :cond_0
    :goto_0
    :pswitch_0
    invoke-virtual {p0}, Lorg/zeam/ColourPickerDialog;->dismiss()V

    .line 89
    return-void

    .line 83
    :pswitch_1
    iget-object v0, p0, Lorg/zeam/ColourPickerDialog;->mOnColourChangedListener:Lorg/zeam/ColourPickerDialog$OnColourChangedListener;

    if-eqz v0, :cond_0

    .line 84
    iget-object v0, p0, Lorg/zeam/ColourPickerDialog;->mOnColourChangedListener:Lorg/zeam/ColourPickerDialog$OnColourChangedListener;

    iget-object v1, p0, Lorg/zeam/ColourPickerDialog;->mNewColour:Lorg/zeam/ColourPickerPanelView;

    invoke-virtual {v1}, Lorg/zeam/ColourPickerPanelView;->getColor()I

    move-result v1

    invoke-interface {v0, v1}, Lorg/zeam/ColourPickerDialog$OnColourChangedListener;->onColourChanged(I)V

    goto :goto_0

    .line 79
    nop

    :pswitch_data_0
    .packed-switch 0x7f06000a
        :pswitch_0
        :pswitch_1
    .end packed-switch
.end method

.method public onColorChanged(I)V
    .locals 1
    .parameter "color"

    .prologue
    .line 61
    iget-object v0, p0, Lorg/zeam/ColourPickerDialog;->mNewColour:Lorg/zeam/ColourPickerPanelView;

    invoke-virtual {v0, p1}, Lorg/zeam/ColourPickerPanelView;->setColor(I)V

    .line 62
    return-void
.end method

.method public setAlphaSliderVisible(Z)V
    .locals 1
    .parameter "visible"

    .prologue
    .line 65
    iget-object v0, p0, Lorg/zeam/ColourPickerDialog;->mColourPicker:Lorg/zeam/ColourPickerView;

    invoke-virtual {v0, p1}, Lorg/zeam/ColourPickerView;->setAlphaSliderVisible(Z)V

    .line 66
    return-void
.end method

.method public setOnColourChangedListener(Lorg/zeam/ColourPickerDialog$OnColourChangedListener;)V
    .locals 0
    .parameter "onColourChangedListener"

    .prologue
    .line 69
    iput-object p1, p0, Lorg/zeam/ColourPickerDialog;->mOnColourChangedListener:Lorg/zeam/ColourPickerDialog$OnColourChangedListener;

    .line 70
    return-void
.end method
